<template>
	<view class="">
		<!-- 个人信息 -->
		<view class="info flex justify-center">
			<view class="info-box">
				<view class="info-box-c flex align-center">
					<image :src="avatar" mode=""></image>
					<view class="info-box-c-txt">
						<view class="info-box-c-txt-title">
							{{userName}}
						</view>
						<view class="info-box-c-txt-status">
							已认证
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 统计 -->
		<view class="tongji flex justify-center" @click="goNav('/work/statistics/statistics?companyId='+userId)">
			<view class="tongji-box flex">
				<view class="tongji-box-l">
					<view class="tongji-box-l-t flex align-center">
						<span></span>
						派单金额
					</view>
					<view class="tongji-box-l-c">
						{{money}}<span>元</span>
					</view>
					<view class="tongji-box-l-b">
						总收入金额
					</view>
				</view>
				<view class="tongji-box-r">
					<view class="tongji-box-l-t flex align-center">
						<span></span>
						派单数量
					</view>
					<view class="tongji-box-l-c">
						{{counts}}<span>单</span>
					</view>
					<view class="tongji-box-l-b">
						总完成派单量
					</view>
				</view>
			</view>
		</view>
		<!-- 功能 -->
		<view class="tongji flex justify-center" style="margin-top: 20rpx;height: 380rpx;">
			<view class="tongji-box flex justify-center">
				<view class="yuangong">
					<view class="yuangong-item flex justify-between" @click="goNav('/work/workList/workList')">
						<view class="yuangong-item-l flex align-center">
							<image src="../static/work.png" mode=""></image>
							员工列表
						</view>
						<u-icon name="arrow-right" color="#808080" size="28"></u-icon>
					</view>
					<view class="yuangong-item flex justify-between" @click="goNav('/work/index/order')">
						<view class="yuangong-item-l flex align-center">
							<image src="../static/pd.png" mode=""></image>
							派单管理
						</view>
						<u-icon name="arrow-right" color="#808080" size="28"></u-icon>
					</view>
					<view class="yuangong-item flex justify-between" @click="goNav('/work/paihang/paihang')">
						<view class="yuangong-item-l flex align-center">
							<image src="../static/ph.png" mode=""></image>
							排行榜
						</view>
						<u-icon name="arrow-right" color="#808080" size="28"></u-icon>
					</view>
				</view>

			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				counts: 0,
				money: 0,
				avatar: '../../static/logo.png',
				userName: '匿名',
				userId:''
			}
		},
		onLoad() {

		},
		onShow() {
			this.getUserInfo()
			this.getorder()

		},
		methods: {
			// 跳转
			goNav(url) {
				uni.navigateTo({
					url: url
				})
			},
			getorder() {
				this.$Request.get("/app/orders/selectCompanyStatistics").then(res => {
					if (res.code == 0) {
						this.counts = res.data.counts
						this.money = res.data.money
					}
				});
			},
			getUserInfo() {
				this.$Request.get("/app/user/selectUserById").then(res => {
					if (res.code == 0) {
						this.userName = res.data.userName
						this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
						this.userId = res.data.userId
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #F5F5F5;
	}

	.info {
		width: 100%;
		height: 750rpx;
		background: linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, #557EFD 100%);

		.info-box {
			width: 690rpx;

			.info-box-c {
				width: 100%;
				height: 88rpx;
				margin-top: 40rpx;

				image {
					width: 88rpx;
					height: 100%;
					border-radius: 50%;
				}

				.info-box-c-txt {
					margin-left: 14rpx;
				}

				.info-box-c-txt-title {
					color: #ffffff;
					font-size: 28rpx;
					font-weight: bold;
				}

				.info-box-c-txt-status {
					color: #ffffff;
					font-size: 24rpx;
					font-weight: 500;
					margin-top: 4rpx;
				}
			}
		}
	}

	.tongji {
		width: 100%;
		height: 220rpx;
		margin-top: -600rpx;

		.tongji-box {
			width: 690rpx;
			height: 100%;
			border-radius: 20rpx;
			background-color: #ffffff;

			.tongji-box-l {
				width: 50%;
				height: 100%;
				padding-left: 40rpx;
				margin-top: 30rpx;

				.tongji-box-l-t {
					color: #333333;
					font-size: 28rpx;
					font-weight: bold;
					
					span {
						display: inline-block;
						width: 6rpx;
						height: 28rpx;
						background-color: #FE3B27;
						margin-right: 10rpx;
					}
				}

				.tongji-box-l-c {
					margin-top: 10rpx;
					color: #333333;
					font-size:60rpx;

					// font-weight: bold;
					span {
						font-size: 28rpx;
						margin-left: 10rpx;
					}
				}

				.tongji-box-l-b {
					color: #B3B3B3;
					font-size: 22rpx;
					margin-top: 10rpx;
				}
			}

			.tongji-box-r {
				width: 50%;
				height: 100%;
				padding-left: 40rpx;
				margin-top: 30rpx;

				.tongji-box-l-t {
					color: #333333;
					font-size: 28rpx;
					font-weight: bold;
					
					span {
						display: inline-block;
						width: 6rpx;
						height: 28rpx;
						background-color: #009C66;
						margin-right: 10rpx;
					}

					
				}

				.tongji-box-l-c {
					margin-top: 10rpx;
					color: #333333;
					font-size: 60rpx;

					// font-weight: bold;
					span {
						font-size: 28rpx;
						margin-left: 10rpx;
					}
				}

				.tongji-box-l-b {
					color: #B3B3B3;
					font-size: 22rpx;
					margin-top: 10rpx;
				}
			}

		}

		.yuangong {
			width: calc(100% - 60rpx);
			height: 100%;

			.yuangong-item {
				margin-top: 48rpx;
				color: #1A1A1A;
				font-size: 28rpx;
				font-weight: 500;
				padding: 10rpx 0;

				.yuangong-item-l {
					color: #1A1A1A;
					font-size: 28rpx;

					image {
						width: 42rpx;
						height: 42rpx;
						margin-right: 30rpx;
					}
				}
			}
		}
	}
</style>
